package com.jyu.edu.entity;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@Entity
@Table(name="permission")
public class Permission {
	@Id
	@GeneratedValue(strategy=GenerationType.SEQUENCE)
	long id;//主键
	@Column(unique=true)
	String name;//名称
	@Column(unique=true)
	String stringPermission;//权限-映射
	@Column
	boolean isParent;//是否含有子权限
	@Column
	Long pid;//父权限主键---包装类，可能为空
	@ManyToMany(mappedBy="permissions")
	List<Role> roles;
	@Column
	String icon;
}
